<?php
namespace app\common\model;

use think\Model;

class SystemMenu extends Model
{
    protected $pk = 'sm_id';

    public function getSmTypeAttr($value)
    {
        $status = ['admin'=>'系统后台','agent'=>'代理后台','index'=>'商户后台'];
        return $status[$value];
    }

    public function scopeNames($query, $name)
    {
        $query->where('sm_name', 'like', '%' . $name . '%');
    }
}